# -*- coding: utf-8 -*-
#
# Author:: hanjunfeng
# Date:: 2021/3/22
import pymysql


class _Connection(pymysql.Connection):
    def __init__(self, **kwargs):
        self.conn = pymysql.connect(**kwargs)
        self.cursor = self.conn.cursor()

    def exec_sql(self, sql):
        self.cursor.execute(sql)
        res = self.cursor.fetchall()
        return res


if __name__ == "__main__":
    f_b_w_offline = {
        "host": "10.225.114.49",
        "port": 3306,
        "user": "f_b_w",
        "password": "FohgX0hRdtoaL4g_QgGMAyZtQNSHTAKE"
    }

    from lib import pymysql_


    def test_exec_sql():
        conn = pymysql_.connect(**f_b_w_offline)
        res = conn.exec_sql("SELECT VERSION()")
        conn.close()
        print(res)
        print(res[0][0])


    test_exec_sql()
